package com.bafa.util.comparators;

import java.util.Comparator;

import com.bafa.objects.Match;

public class MatchByDateComparator implements Comparator {

	public int compare(Object arg0, Object arg1) {
		Match match1 = (Match)arg0;
		Match match2 = (Match)arg1;
		int compare = 0;
		if(match1.getDate()==null||match2.getDate()==null)
			compare = 1;
		else{
		compare =match1.getDate().compareTo(match2.getDate()); 
		if(compare==0){
			compare = 1;
		}
		
		if(compare==0){
			compare = match1.getTeamAName().compareTo(match2.getTeamBName());
		}
		}
		return compare;
	}

}
